//
//  LBLimitedTextField.h
//  LBLimitedTextField
//
//  Created by 刘文扬 on 17/6/28.
//  Copyright © 2017年 lianj. All rights reserved.
//

#import <UIKit/UIKit.h>

@class LBLimitedTextField;
@protocol LBLimitedTextFieldDelegate <NSObject>

@optional
-(void)limitedTextFieldOverLimitedWithTextField:(LBLimitedTextField *)limitedTextField textFieldType:(NSInteger)textFieldType maxTextLength:(NSInteger)maxTextLength;

-(void)limitedTextField:(LBLimitedTextField *)limitedTextField textCount:(NSInteger)textCount;


@end

typedef NS_ENUM(NSInteger,LBLimitedTextFieldType){
    LBLimitedTextFieldDefault,
    LBLimitedTextFieldFloat,
    LBLimitedTextFieldInt
};


@interface LBLimitedTextField : UITextField

/** maxTextLength*/
@property(nonatomic,assign)NSInteger maxTextLength;

/** lb_degegate*/
@property(nonatomic,weak)id<LBLimitedTextFieldDelegate> lb_degegate;

/** 是否可以输入emoji 默认是不可以*/
@property(nonatomic,assign)BOOL canEmoji;

/** 输入类型,普通或者是浮点或者是整型,整型类型下键盘类型是纯数字,浮点型下是带点的纯数字键盘*/
@property(nonatomic,assign)LBLimitedTextFieldType inputType;

/** 整数位数*/
@property(nonatomic,assign)NSInteger limitedIntNumber;

/** 小数位数,只有在LBLimitedTextFieldFloat下才生效*/
@property(nonatomic,assign)NSInteger limitedFloatNumber;

@end

@interface LBLimitedTextFieldMatcher : NSObject

+(BOOL)matchIntWithLimitedIntNumber:(NSInteger)limitedIntNumber text:(NSString *)text;

+(BOOL)matchFloatWithLimitedIntNumber:(NSInteger)limitedIntNumber floatNumber:(NSInteger)floatNumber text:(NSString *)text;

@end

@interface NSString (LBEmoji)

- (BOOL)containEmoji;

- (NSString *)converStrEmoji:(NSString *)emojiStr;

+(BOOL)nowIsEmojiKeyBorad;

@end
